#ifndef QSOCKETVIEWERPROTOCOL_H
#define QSOCKETVIEWERPROTOCOL_H 

#include "ViewerProtocol.h"
#include <QString>
#include <QVector>
#include <QHostAddress>
#include <QTcpSocket>
#include <QtNetwork>

class QSocketViewerProtocol: public ViewerProtocol
{
public:
	QSocketViewerProtocol();
	~QSocketViewerProtocol();
	int receive();
	void connect(QString);

	float* getLocationData(); //QVector...

	void bind();
	void close();
	ViewerProtocol* acceptConnection();
	void sendMessage(int, int);
	void sendObjects(const void*, int);
	void waitRequest();
	int getCount();
	ElementData getNewElement(int);
	void writeElementData(const ElementData);
	ElementData readElementData();
	void sendRequest();
private:
	QSocketViewerProtocol(QTcpSocket*);
	int count;
	int sizesum;
	QTcpSocket* socket;
	QTcpServer* server;
	float* ldata;
	QVector<ElementData> newElements;
};

#endif 
